public class Test {
    public static void main(String[] args) {
        int max = Math.max(10,20);
        System.out.println(max);

        int absValue = Math.abs(10-20);
        System.out.println(absValue);
    }

    public static void main11(String[] args) {

        int num = 16;
        int i = 0;
        for(i = 2; i <= Math.sqrt(num); i++){
            if(num % i == 0){
                System.out.println(num + "不是素数");
                break;
            }
        }

        if(i > Math.sqrt(num)){
            System.out.println(num +"是素数");
        }

        // 素数:只能被1和它本身整除的数
        /*int num = 16;
        boolean flag = true;
        for (int i = 2; i < num; i++){
            if(num % i == 0){
                System.out.println("不是素数");
                flag = false;
                break;
            }
        }

        if(flag == true){
            System.out.println("是素数");
        }*/

    }



    public static void main10(String[] args) {
        byte a = 0;
        do{
            System.out.println(a);
            a++;
        }while (a != 0);
    }

    public static void main9(String[] args) {
        for(int i = 1; ;i++){
            System.out.println("飞起来");
        }
    }

    public static void main8(String[] args) {
        /*for(int i = 1; i <= 10; i++) {
            System.out.println(i);
        }*/

        /*int sum = 0;
        for(int i = 1; i <= 100; i++){
            sum += i;
        }
        System.out.println(sum);*/

        /*int ret = 1;
        for(int i = 1; i <= 5; i++){
            ret *= i;
        }
        System.out.println(ret);*/

        int sum = 0;
        for(int i = 1; i <= 5; i++){
            int ret = 1;
            for(int j = 1; j <= i; j++){
                ret *= j;
            }
            sum += ret;
        }
        System.out.println(sum);

    }

    public static void main7(String[] args) {
        /*int num = 100;
        while(num <= 200){
            if(num % 3 == 0){
                System.out.println(num);
                break;
            }
            num++;
        }*/

        /*int num = 1;
        while(num <= 10){
            if(num == 3){
                num++;
                continue;
            }
            System.out.println(num);
            num++;
        }*/

        /*int num = 100;
        while(num <= 200){
            if(num % 3 != d0){
                num++;
                continue;
            }

            System.out.println(num);
            num++;
        }*/

    }

    public static void main6(String[] args) {
        /*int a = 1;
        while(a <= 10){
            System.out.println(a);
            a++;
        }*/

        // 死循环
        /*boolean flag = true;
        while(flag){
            System.out.println("do code");
        }*/

        /*int i = 1;
        int sum = 0;
        while(i <= 100){
            sum += i;
            i++;
        }
        System.out.println(sum);*/

        int x = 1;
        int sum = 0;
        while(x <= 5){
            int i = 1;
            int ret = 1;
            while(i <= x){
                ret *= i;
                i++;
            }
            sum += ret;
            x++;
        }
        System.out.println(sum);
    }

    public static void main5(String[] args) {
        /*int a = 2;
        switch (a) {
            case 2:
                System.out.println(2);
                break;
            case 1:
                System.out.println(1);
                break;
            case 3:
                System.out.println(3);
                break;
            default:
                System.out.println("出错了");
                break;
        }*/

        //err ()里的表达式不能是long、double、float、boolean
        /*double a = 1.5;

        switch (a) {
            case 2.0:
                System.out.println(2);
                break;
            case 1.0:
                System.out.println(1);
                break;
            case 3.0:
                System.out.println(3);
                break;
            default:
                System.out.println("出错了");
                break;
        }*/


    }
    public static void main4(String[] args) {
        /*System.out.println("aaa");
        System.out.println("bbb");
        System.out.println("ccc");*/

        // int score = 75;
        /*if(score >= 90){
            System.out.println("奖励玩NBA2k");
        }else{
            System.out.println("一个星期不能玩NBA2k");
        }*/

        /*if(score >= 90){
            System.out.println("优秀");
        }else if(score >= 80 && score < 90 ){
            System.out.println("良好");
        }else if(score >= 70 && score < 80){
            System.out.println("中等");
        }else if(score >= 60 && score < 70){
            System.out.println("良好");
        }else{
            System.out.println("错误数据");
        }*/

        // int num = 0;
        /*if(num % 2 == 0){
            System.out.println("偶数");
        }else{
            System.out.println("奇数");
        }*/

        /*if(num > 0){
            System.out.println("正数");
        }else if(num < 0){
            System.out.println("负数");
        }else {
            System.out.println("0");
        }*/

        int year = 2020;
        if(year % 100 != 0){
            if(year % 4 == 0){
                System.out.println("润年");
            }else{
                System.out.println("不是润年");
            }
        }else{
            if(year % 400 == 0){
                System.out.println("润年!");
            }else {
                System.out.println("不是润年!");
            }
        }

    }

    public static void main3(String[] args) {
        short a = 128;
        byte b = (byte)a; // [-128, 127] 溢出
        System.out.println("a = " + a); // 128
        System.out.println("b = " + b); // -128

        // 优先级: 可以使用()
        int ret = 3*(2+1);
        System.out.println(ret);
    }

    public static void main2(String[] args) {
//        int a = 10;
//        int b = 20;
//        int ret = a > b? a:b;
//        System.out.println(ret);

        boolean flag = true == true? true == false ? true : false : false;
        System.out.println(flag);

    }

    public static void main1(String[] args) {
//        int a = -10;
//        a <<= 1;
//        System.out.println(a);
//        a <<= 1;
//        System.out.println(a);
//
//        a <<= 1;
//        System.out.println(a);
//
//        a <<= 1;
//        System.out.println(a);
//
//        a <<= 1;
//        System.out.println(a);
//
//        a <<= 1;
//        System.out.println(a);

//        int a = -10;
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
//
//        a >>= 1;
//        System.out.println(a);
        int a = -1;
        a >>>= 1;
        System.out.println(a);

        a >>>= 1;
        System.out.println(a);

        a >>>= 1;
        System.out.println(a);

        a >>>= 1;
        System.out.println(a);

    }
}
